6/5/2025 19.45
1 m distance, 1 m from ground, 2 m from window
Gras mic no cover in channel A +20 gain
Fireface 802 channel out = 1 channel in 9 (gain 30)
Amplifier AVR 445 -20 dB volume
Tweeter 1
playback_sweeps_1_95.wav file repeated every 30 seconds for 10 minutes
7/5/2025 11.30
same as above every 60 seconds for 1 hour
from IPython.display import Image
Image(filename="./PXL_20250507_084633979.jpg")
from IPython.display import Image
Image(filename="./rme802_matrix.png")
Image(filename="./rme802_mixer.png")
# %%
import numpy as np
import os
import soundfile as sf
import matplotlib.pyplot as plt
import scipy.signal as signal
# Load audio files
DIR = "./2025-05-06/original/" # Directory containing the audio files
DIR2 = "./2025-05-07/original/"
audio_files = os.listdir(DIR) # List all files in the sweeps directory
audio_files2 = os.listdir(DIR2) # List all files in the sweeps directory
audio_files.sort() # Sort the files in ascending order
audio_files2.sort() # Sort the files in ascending order
# Define the matched filter function
def matched_filter(recording, chirp_template):
chirp_template = chirp_template[::-1] # Time-reversed chirp
filtered_output = signal.fftconvolve(recording, chirp_template, mode='valid')
return filtered_output
# Detect peaks in the matched filter output
def detect_peaks(filtered_output, threshold=0.5):
peaks, _ = signal.find_peaks(filtered_output, height=threshold * np.max(filtered_output))
return peaks
def compute_rms(audio_signal):
"""Compute the RMS of the audio signal."""
return np.sqrt(np.mean(audio_signal**2))
def rms_to_db(rms_value):
"""Convert RMS value to decibels."""
return 20 * np.log10(rms_value) if rms_value > 0 else -np.inf
DIR_first_sweep = "./2025-05-06/first_sweep/" # Directory to save the first sweeps
DIR2_first_sweep = "./2025-05-07/first_sweep/" # Directory to save the first sweeps
DIR_second_sweep = "./2025-05-06/first_sweep/" # Directory to save the first sweeps
DIR2_second_sweep = "./2025-05-07/second_sweep/" # Directory to save the first sweeps
os.makedirs(DIR_first_sweep, exist_ok=True) # Create the directory if it doesn't exist
os.makedirs(DIR_second_sweep, exist_ok=True) # Create the directory if it doesn't exist
os.makedirs(DIR2_first_sweep, exist_ok=True) # Create the directory if it doesn't exist
os.makedirs(DIR2_second_sweep, exist_ok=True) # Create the directory if it doesn't exist
durns = np.array([3, 5, 7] )*1e-3
fs = 192000 # Hz
t1 = np.linspace(0, durns[0], int(fs*durns[0]))
start_f1, end_f1 = 1e3, 95e3
sweep1 = signal.chirp(t1, start_f1, t1[-1], end_f1)
sweep1 *= signal.windows.tukey(sweep1.size, 0.95)
sweep1 *= 0.8
sweep1_padded = np.pad(sweep1, pad_width=[int(fs*0.1)]*2, constant_values=[0,0])
t2 = np.linspace(0, durns[1], int(fs*durns[1]))
start_f2, end_f2 = 1e3, 95e3
sweep2 = signal.chirp(t2, start_f2, t2[-1], end_f2)
sweep2 *= signal.windows.tukey(sweep2.size, 0.95)
sweep2 *= 0.8
sweep2_padded = np.pad(sweep2, pad_width=[int(fs*0.1)]*2, constant_values=[0,0])
dur1 = len(sweep1) / fs
plt.figure()
plt.subplot(2, 1, 1)
plt.plot(t1, sweep1)
plt.subplot(2, 1, 2)
plt.specgram(sweep1, NFFT=64, noverlap=32, Fs=fs)
plt.suptitle('Sweep 1')
dur2 = len(sweep2) / fs
plt.figure()
plt.subplot(2, 1, 1)
plt.plot(t2, sweep2)
plt.subplot(2, 1, 2)
plt.specgram(sweep2, NFFT=64, noverlap=32, Fs=fs)
plt.suptitle('Sweep 2')
plt.figure()
rms_values1 = []
db_values1 = []
rms_values2 = []
db_values2 = []
rms2_values1 = []
db2_values1 = []
rms2_values2 = []
db2_values2 = []
# TEST 1
print('\nTEST 1\n')
for file in audio_files:
file_path = os.path.join(DIR, file)
date = file.split('_')[1]
date1 = date.split('g')[1]
hour = file.split('_')[2]
hour = hour.split('.')[0]
hour = hour.split('-')[0]
minute = file.split('_')[2]
minute = minute.split('.')[0]
minute = minute.split('-')[1]
sec = file.split('_')[2]
sec = sec.split('.')[0]
sec = sec.split('-')[2]
print(f"Extracted Hour: {hour}, Min: {minute}, Sec: {sec}")
file_time = file.split('.')[0].split('_')[2]
# Display all the sweep files to check for consistency
#fig1, ax1 = plt.subplots(figsize=(15, 5))
#ax1.set_title(file.split('_')[1] + f'\n Hour: {hour}, Minute: {minute}')
#ax1.set_xlabel('Time (s)')
#ax1.set_ylabel('RMS Value')
#ax1.grid(True)
#fig2, ax2 = plt.subplots(figsize=(15, 5))
#ax2.set_title(file.split('_')[1] + f'\n Hour: {hour}, Minute: {minute}')
#ax2.set_xlabel('Time (s)')
#ax2.set_ylabel('RMS Value')
#ax2.grid(True)
recording, sample_rate = sf.read(DIR +file)
# Apply matched filtering
filtered_output1 = matched_filter(recording, sweep1)
filtered_output2 = matched_filter(recording, sweep2)
# Detect peaks
peaks1 = detect_peaks(filtered_output1)
peaks2 = detect_peaks(filtered_output2)
if len(peaks1) > 0:
# Extract the first sweep
first_sweep_start = peaks1[0]
first_sweep_end = first_sweep_start + len(sweep1)
first_sweep = recording[first_sweep_start:first_sweep_end]
rms_value = compute_rms(first_sweep)
rms_values1.append([rms_value, hour, minute, sec])
#print(rms_values)
db_value = rms_to_db(rms_value)
db_values1.append([db_value, hour, minute])
sf.write(DIR_first_sweep + file_time + '.wav', first_sweep, int(fs))
# Plot the first sweep
#ax1.plot(np.linspace(0,len(first_sweep),len(first_sweep))/fs, first_sweep, label=file_time)
if len(peaks2) > 0:
# Extract the first sweep
second_sweep_start = peaks2[0]
second_sweep_end = second_sweep_start + len(sweep2)
second_sweep = recording[second_sweep_start:second_sweep_end]
rms_value = compute_rms(second_sweep)
rms_values2.append([rms_value, hour, minute,sec])
#print(rms_values)
db_value = rms_to_db(rms_value)
db_values2.append([db_value, hour, minute])
sf.write(DIR_second_sweep + file_time + '.wav', second_sweep, int(fs))
# Plot the first sweep
#ax2.plot(np.linspace(0,len(second_sweep),len(second_sweep))/fs, second_sweep, label=file_time, color='orange')
print(f"RMS Values: {rms_values1}")
print(f"dB Values: {db_values1}")
print(f"RMS Values: {rms_values2}")
print(f"dB Values: {db_values2}")
#plt.show(block = True)
# TEST 2
print('\nTEST 2\n')
for file in audio_files2:
file_path = os.path.join(DIR2, file)
date = file.split('_')[1]
date2 = date.split('g')[1]
hour = file.split('_')[2]
hour = hour.split('.')[0]
hour = hour.split('-')[0]
minute = file.split('_')[2]
minute = minute.split('.')[0]
minute = minute.split('-')[1]
sec = file.split('_')[2]
sec = sec.split('.')[0]
sec = sec.split('-')[2]
print(f"Extracted Hour: {hour}, Min: {minute}, Sec: {sec}")
file_time = file.split('.')[0].split('_')[2]
# Display all the sweep files to check for consistency
#fig1, ax1 = plt.subplots(figsize=(15, 5))
#ax1.set_title(file.split('_')[1] + f'\n Hour: {hour}, Minute: {minute}')
#ax1.set_xlabel('Time (s)')
#ax1.set_ylabel('RMS Value')
#ax1.grid(True)
#fig2, ax2 = plt.subplots(figsize=(15, 5))
#ax2.set_title(file.split('_')[1] + f'\n Hour: {hour}, Minute: {minute}')
#ax2.set_xlabel('Time (s)')
#ax2.set_ylabel('RMS Value')
#ax2.grid(True)
recording, sample_rate = sf.read(DIR2 +file)
# Apply matched filtering
filtered_output1 = matched_filter(recording, sweep1)
filtered_output2 = matched_filter(recording, sweep2)
# Detect peaks
peaks1 = detect_peaks(filtered_output1)
peaks2 = detect_peaks(filtered_output2)
if len(peaks1) > 0:
# Extract the first sweep
first_sweep_start = peaks1[0]
first_sweep_end = first_sweep_start + len(sweep1)
first_sweep = recording[first_sweep_start:first_sweep_end]
rms_value = compute_rms(first_sweep)
rms2_values1.append([rms_value, hour, minute, sec])
#print(rms_values)
db_value = rms_to_db(rms_value)
db2_values1.append([db_value, hour, minute])
sf.write(DIR2_first_sweep + file_time + '.wav', first_sweep, int(fs))
# Plot the first sweep
#ax1.plot(np.linspace(0,len(first_sweep),len(first_sweep))/fs, first_sweep, label=file_time)
if len(peaks2) > 0:
# Extract the first sweep
second_sweep_start = peaks2[0]
second_sweep_end = second_sweep_start + len(sweep2)
second_sweep = recording[second_sweep_start:second_sweep_end]
rms_value = compute_rms(second_sweep)
rms2_values2.append([rms_value, hour, minute,sec])
#print(rms_values)
db_value = rms_to_db(rms_value)
db2_values2.append([db_value, hour, minute])
sf.write(DIR2_second_sweep + file_time + '.wav', second_sweep, int(fs))
# Plot the first sweep
#ax2.plot(np.linspace(0,len(second_sweep),len(second_sweep))/fs, second_sweep, label=file_time, color='orange')
print(f"RMS Values: {rms2_values1}")
print(f"dB Values: {db2_values1}")
print(f"RMS Values: {rms2_values2}")
print(f"dB Values: {db2_values2}")
#plt.show(block = True)
TEST 1 Extracted Hour: 19, Min: 59, Sec: 03 Extracted Hour: 19, Min: 59, Sec: 34 Extracted Hour: 20, Min: 00, Sec: 05 Extracted Hour: 20, Min: 00, Sec: 36 Extracted Hour: 20, Min: 01, Sec: 07 Extracted Hour: 20, Min: 01, Sec: 39 Extracted Hour: 20, Min: 02, Sec: 10 Extracted Hour: 20, Min: 02, Sec: 41 Extracted Hour: 20, Min: 03, Sec: 12 Extracted Hour: 20, Min: 03, Sec: 43 Extracted Hour: 20, Min: 04, Sec: 14 Extracted Hour: 20, Min: 04, Sec: 45 Extracted Hour: 20, Min: 05, Sec: 16 Extracted Hour: 20, Min: 05, Sec: 48 Extracted Hour: 20, Min: 06, Sec: 19 Extracted Hour: 20, Min: 06, Sec: 50 Extracted Hour: 20, Min: 07, Sec: 21 Extracted Hour: 20, Min: 07, Sec: 52 Extracted Hour: 20, Min: 08, Sec: 23 Extracted Hour: 20, Min: 08, Sec: 54 RMS Values: [[0.09543886894007893, '19', '59', '03'], [0.09556033131373814, '19', '59', '34'], [0.09535893286241325, '20', '00', '05'], [0.0955033446444304, '20', '00', '36'], [0.09555129539403834, '20', '01', '07'], [0.09542281044220619, '20', '01', '39'], [0.09546636026222559, '20', '02', '10'], [0.09576571624651325, '20', '02', '41'], [0.09538586762991241, '20', '03', '12'], [0.0952882964229249, '20', '03', '43'], [0.09540179558355157, '20', '04', '14'], [0.09541150167522103, '20', '04', '45'], [0.09530452331891097, '20', '05', '16'], [0.09540840410647042, '20', '05', '48'], [0.09556098075981465, '20', '06', '19'], [0.095575986018384, '20', '06', '50'], [0.09560204118606938, '20', '07', '21'], [0.09526453833840712, '20', '07', '52'], [0.09566220564627481, '20', '08', '23'], [0.09534437099964625, '20', '08', '54']] dB Values: [[-20.405494323886128, '19', '59'], [-20.394447063859932, '19', '59'], [-20.412772353116736, '20', '00'], [-20.399628372474908, '20', '00'], [-20.3952684163093, '20', '01'], [-20.406955930438645, '20', '01'], [-20.40299269946422, '20', '02'], [-20.375798776630806, '20', '02'], [-20.410319311997128, '20', '03'], [-20.419208747164493, '20', '03'], [-20.40886902485108, '20', '04'], [-20.40798537531154, '20', '04'], [-20.417729729977644, '20', '05'], [-20.408267370423175, '20', '05'], [-20.39438803311255, '20', '06'], [-20.393024256943146, '20', '06'], [-20.39065670125982, '20', '07'], [-20.42137465670303, '20', '07'], [-20.38519219979267, '20', '08'], [-20.41409884018438, '20', '08']] RMS Values: [[0.09571305044782005, '19', '59', '03'], [0.09580927215890989, '19', '59', '34'], [0.095582438611567, '20', '00', '05'], [0.09565580001383163, '20', '00', '36'], [0.0957320491099592, '20', '01', '07'], [0.0955814258392439, '20', '01', '39'], [0.09565678280060463, '20', '02', '10'], [0.0959884179272479, '20', '02', '41'], [0.0955839445175427, '20', '03', '12'], [0.09546743707762438, '20', '03', '43'], [0.0955879473647045, '20', '04', '14'], [0.09560983252218444, '20', '04', '45'], [0.09550002552033508, '20', '05', '16'], [0.09558637946437447, '20', '05', '48'], [0.09581981484378291, '20', '06', '19'], [0.09578182678696569, '20', '06', '50'], [0.09578100550266672, '20', '07', '21'], [0.09544415611314323, '20', '07', '52'], [0.09582033959516291, '20', '08', '23'], [0.09562021805511621, '20', '08', '54']] dB Values: [[-20.380576845077584, '19', '59'], [-20.371849181145194, '19', '59'], [-20.39243786884755, '20', '00'], [-20.38577383471294, '20', '00'], [-20.378852901414, '20', '01'], [-20.392529903277303, '20', '01'], [-20.385684594608367, '20', '02'], [-20.355623325403975, '20', '02'], [-20.392301023311255, '20', '03'], [-20.4028947272891, '20', '03'], [-20.391937284810282, '20', '04'], [-20.38994885101649, '20', '04'], [-20.39993024720691, '20', '05'], [-20.392079758012166, '20', '05'], [-20.370893453611124, '20', '06'], [-20.374337683739782, '20', '06'], [-20.374412161494124, '20', '07'], [-20.405013151694597, '20', '07'], [-20.370845885995795, '20', '08'], [-20.389005405227568, '20', '08']] TEST 2 Extracted Hour: 11, Min: 30, Sec: 05 Extracted Hour: 11, Min: 31, Sec: 06 Extracted Hour: 11, Min: 32, Sec: 07 Extracted Hour: 11, Min: 33, Sec: 08 Extracted Hour: 11, Min: 34, Sec: 09 Extracted Hour: 11, Min: 35, Sec: 10 Extracted Hour: 11, Min: 36, Sec: 12 Extracted Hour: 11, Min: 37, Sec: 13 Extracted Hour: 11, Min: 38, Sec: 14 Extracted Hour: 11, Min: 39, Sec: 15 Extracted Hour: 11, Min: 40, Sec: 16 Extracted Hour: 11, Min: 41, Sec: 17 Extracted Hour: 11, Min: 42, Sec: 18 Extracted Hour: 11, Min: 43, Sec: 20 Extracted Hour: 11, Min: 44, Sec: 21 Extracted Hour: 11, Min: 45, Sec: 22 Extracted Hour: 11, Min: 46, Sec: 23 Extracted Hour: 11, Min: 47, Sec: 24 Extracted Hour: 11, Min: 48, Sec: 25 Extracted Hour: 11, Min: 49, Sec: 27 Extracted Hour: 11, Min: 50, Sec: 28 Extracted Hour: 11, Min: 51, Sec: 29 Extracted Hour: 11, Min: 52, Sec: 30 Extracted Hour: 11, Min: 53, Sec: 31 Extracted Hour: 11, Min: 54, Sec: 32 Extracted Hour: 11, Min: 55, Sec: 33 Extracted Hour: 11, Min: 56, Sec: 35 Extracted Hour: 11, Min: 57, Sec: 36 Extracted Hour: 11, Min: 58, Sec: 37 Extracted Hour: 11, Min: 59, Sec: 38 Extracted Hour: 12, Min: 00, Sec: 39 Extracted Hour: 12, Min: 01, Sec: 40 Extracted Hour: 12, Min: 02, Sec: 42 Extracted Hour: 12, Min: 03, Sec: 43 Extracted Hour: 12, Min: 04, Sec: 44 Extracted Hour: 12, Min: 05, Sec: 45 Extracted Hour: 12, Min: 06, Sec: 46 Extracted Hour: 12, Min: 07, Sec: 47 Extracted Hour: 12, Min: 08, Sec: 48 Extracted Hour: 12, Min: 09, Sec: 50 Extracted Hour: 12, Min: 10, Sec: 51 Extracted Hour: 12, Min: 11, Sec: 52 Extracted Hour: 12, Min: 12, Sec: 53 Extracted Hour: 12, Min: 13, Sec: 54 Extracted Hour: 12, Min: 14, Sec: 55 Extracted Hour: 12, Min: 15, Sec: 56 Extracted Hour: 12, Min: 16, Sec: 58 Extracted Hour: 12, Min: 17, Sec: 59 Extracted Hour: 12, Min: 19, Sec: 00 Extracted Hour: 12, Min: 20, Sec: 01 Extracted Hour: 12, Min: 21, Sec: 02 Extracted Hour: 12, Min: 22, Sec: 03 Extracted Hour: 12, Min: 23, Sec: 05 Extracted Hour: 12, Min: 24, Sec: 06 Extracted Hour: 12, Min: 25, Sec: 07 Extracted Hour: 12, Min: 26, Sec: 08 Extracted Hour: 12, Min: 27, Sec: 09 Extracted Hour: 12, Min: 28, Sec: 10 Extracted Hour: 12, Min: 29, Sec: 11 RMS Values: [[0.09708041562579292, '11', '30', '05'], [0.09652613779788752, '11', '31', '06'], [0.0961347113240073, '11', '32', '07'], [0.09602766587072561, '11', '33', '08'], [0.09605583720891964, '11', '34', '09'], [0.09563085265781422, '11', '35', '10'], [0.09589985640646466, '11', '36', '12'], [0.09604646801404373, '11', '37', '13'], [0.09578678482676384, '11', '38', '14'], [0.09580986169564167, '11', '39', '15'], [0.09578938337233328, '11', '40', '16'], [0.09585536298337453, '11', '41', '17'], [0.0958450231316838, '11', '42', '18'], [0.09599238503451171, '11', '43', '20'], [0.09592022151013582, '11', '44', '21'], [0.09595400870906684, '11', '45', '22'], [0.09592324009142371, '11', '46', '23'], [0.09596507415865814, '11', '47', '24'], [0.0959954510343392, '11', '48', '25'], [0.09599612358465666, '11', '49', '27'], [0.09602238926333552, '11', '50', '28'], [0.09605305515190343, '11', '51', '29'], [0.09604498599938133, '11', '52', '30'], [0.09604688865292489, '11', '53', '31'], [0.09610497051627832, '11', '54', '32'], [0.09614181526963514, '11', '55', '33'], [0.09610612135341906, '11', '56', '35'], [0.0961626944114624, '11', '57', '36'], [0.09620304022687987, '11', '58', '37'], [0.09620976380465081, '11', '59', '38'], [0.09626232421662363, '12', '00', '39'], [0.09631850046257646, '12', '01', '40'], [0.0963010942676961, '12', '02', '42'], [0.09634472098183927, '12', '03', '43'], [0.09642359905867014, '12', '04', '44'], [0.0963317965459479, '12', '05', '45'], [0.09642536287112825, '12', '06', '46'], [0.09644871284347888, '12', '07', '47'], [0.09647791181911453, '12', '08', '48'], [0.09648270371137058, '12', '09', '50'], [0.09646775442872521, '12', '10', '51'], [0.09656558211259274, '12', '11', '52'], [0.09656094665108042, '12', '12', '53'], [0.09656729035513105, '12', '13', '54'], [0.09674656841460681, '12', '14', '55'], [0.09677274475176549, '12', '15', '56'], [0.0967240295922984, '12', '16', '58'], [0.09667571642622769, '12', '17', '59'], [0.09660677468011251, '12', '19', '00'], [0.09654903159356121, '12', '20', '01'], [0.09657630864751415, '12', '21', '02'], [0.09658194176062568, '12', '22', '03'], [0.09656705002625506, '12', '23', '05'], [0.09664182330065457, '12', '24', '06'], [0.09660052653071716, '12', '25', '07'], [0.09665543711685826, '12', '26', '08'], [0.09669457731289754, '12', '27', '09'], [0.09667668112308049, '12', '28', '10'], [0.09666685865560065, '12', '29', '11']] dB Values: [[-20.257367460233866, '11', '30'], [-20.307101408907226, '11', '31'], [-20.342395469397566, '11', '32'], [-20.352072546702807, '11', '33'], [-20.349524767925956, '11', '34'], [-20.38803943954559, '11', '35'], [-20.363640862202313, '11', '36'], [-20.350372022649527, '11', '37'], [-20.373888079953915, '11', '38'], [-20.3717957350108, '11', '39'], [-20.373652448557284, '11', '40'], [-20.36767167785099, '11', '41'], [-20.368608669294428, '11', '42'], [-20.35526435351357, '11', '43'], [-20.361796539694037, '11', '44'], [-20.358737537098513, '11', '45'], [-20.361523201591055, '11', '46'], [-20.357735935041894, '11', '47'], [-20.35498693035302, '11', '48'], [-20.354926076663528, '11', '49'], [-20.35254983924441, '11', '50'], [-20.34977634024949, '11', '51'], [-20.35050604855782, '11', '52'], [-20.350333982573986, '11', '53'], [-20.345083003763715, '11', '54'], [-20.3417536428695, '11', '55'], [-20.3449789926549, '11', '56'], [-20.339867530862428, '11', '57'], [-20.336224061760497, '11', '58'], [-20.335617030905052, '11', '59'], [-20.3308731331922, '12', '00'], [-20.325805747202143, '12', '01'], [-20.327375559332342, '12', '02'], [-20.32344153325131, '12', '03'], [-20.316333245869757, '12', '04'], [-20.32460680471662, '12', '05'], [-20.316174362148523, '12', '06'], [-20.31407127718878, '12', '07'], [-20.311442100606275, '12', '08'], [-20.311010698092474, '12', '09'], [-20.312356616840084, '12', '10'], [-20.303552743337274, '12', '11'], [-20.303969704252825, '12', '12'], [-20.30339909154332, '12', '13'], [-20.287288607841134, '12', '14'], [-20.284938818837077, '12', '15'], [-20.28931237502897, '12', '16'], [-20.29365201710114, '12', '17'], [-20.299848340629257, '12', '19'], [-20.305041558495837, '12', '20'], [-20.302587965595325, '12', '21'], [-20.30208134888373, '12', '22'], [-20.303420708311105, '12', '23'], [-20.2966976998845, '12', '24'], [-20.300410128261184, '12', '25'], [-20.295474215340143, '12', '26'], [-20.2919576143318, '12', '27'], [-20.293565343747165, '12', '28'], [-20.29444788545168, '12', '29']] RMS Values: [[0.09697393324159403, '11', '30', '05'], [0.09664509463232761, '11', '31', '06'], [0.09637783225304189, '11', '32', '07'], [0.09634963130258105, '11', '33', '08'], [0.09632766200752234, '11', '34', '09'], [0.09597311380001902, '11', '35', '10'], [0.09626593725976879, '11', '36', '12'], [0.09639335706873203, '11', '37', '13'], [0.0961242623078566, '11', '38', '14'], [0.09614715029090436, '11', '39', '15'], [0.09610415387780748, '11', '40', '16'], [0.09617628220787738, '11', '41', '17'], [0.09615512717345472, '11', '42', '18'], [0.09631425186295624, '11', '43', '20'], [0.09623465033939965, '11', '44', '21'], [0.09624525309232422, '11', '45', '22'], [0.09620916886163436, '11', '46', '23'], [0.09627630592147594, '11', '47', '24'], [0.09628290568842474, '11', '48', '25'], [0.09627079730197163, '11', '49', '27'], [0.09633938847133214, '11', '50', '28'], [0.09633583513704778, '11', '51', '29'], [0.09634962881558096, '11', '52', '30'], [0.09632227891264464, '11', '53', '31'], [0.09640280254175675, '11', '54', '32'], [0.09644334648376224, '11', '55', '33'], [0.09642492668909693, '11', '56', '35'], [0.09644402505932509, '11', '57', '36'], [0.09651640945798873, '11', '58', '37'], [0.09652079045913976, '11', '59', '38'], [0.09658183161642099, '12', '00', '39'], [0.0966249359274081, '12', '01', '40'], [0.0965801449645496, '12', '02', '42'], [0.09663335410589578, '12', '03', '43'], [0.09669336110290983, '12', '04', '44'], [0.09658638183204349, '12', '05', '45'], [0.09676290855362402, '12', '06', '46'], [0.09673549376234407, '12', '07', '47'], [0.09673502480086096, '12', '08', '48'], [0.09678403430350196, '12', '09', '50'], [0.09672924628010679, '12', '10', '51'], [0.0968334031823324, '12', '11', '52'], [0.096876946722015, '12', '12', '53'], [0.09683856862009241, '12', '13', '54'], [0.09701980178458218, '12', '14', '55'], [0.0969966084286619, '12', '15', '56'], [0.09700629287345208, '12', '16', '58'], [0.09691365139633132, '12', '17', '59'], [0.09692277254651638, '12', '19', '00'], [0.09676684174896853, '12', '20', '01'], [0.09682015196741252, '12', '21', '02'], [0.09688529448003119, '12', '22', '03'], [0.09689670958777181, '12', '23', '05'], [0.09687601470267637, '12', '24', '06'], [0.09692847189620685, '12', '25', '07'], [0.09688310729644066, '12', '26', '08'], [0.0968894004383251, '12', '27', '09'], [0.09689994974994257, '12', '28', '10'], [0.09694322809590615, '12', '29', '11']] dB Values: [[-20.266899782861785, '11', '30'], [-20.29640368696125, '11', '31'], [-20.32045692303892, '11', '32'], [-20.322998858065926, '11', '33'], [-20.324979609091173, '11', '34'], [-20.35700828997685, '11', '35'], [-20.330547129167865, '11', '36'], [-20.319057887877054, '11', '37'], [-20.34333960219393, '11', '38'], [-20.34127166611292, '11', '39'], [-20.345156811202926, '11', '40'], [-20.338640300663368, '11', '41'], [-20.340551068079016, '11', '42'], [-20.326188889393467, '11', '43'], [-20.333370546417893, '11', '44'], [-20.33241362218618, '11', '45'], [-20.335670742972884, '11', '46'], [-20.329611635222413, '11', '47'], [-20.329016235533167, '11', '48'], [-20.330108628013107, '11', '49'], [-20.323922295239434, '11', '50'], [-20.3242426671987, '11', '51'], [-20.322999082268222, '11', '52'], [-20.325465017680532, '11', '53'], [-20.318206809344126, '11', '54'], [-20.31455456933083, '11', '55'], [-20.316213653030534, '11', '56'], [-20.314493455610396, '11', '57'], [-20.307976856190688, '11', '58'], [-20.307582601689226, '11', '59'], [-20.302091254472025, '12', '00'], [-20.298215621137537, '12', '01'], [-20.30224294138549, '12', '02'], [-20.297458920151193, '12', '03'], [-20.2920668648447, '12', '04'], [-20.301682049768743, '12', '05'], [-20.285821716950466, '12', '06'], [-20.288282945056242, '12', '07'], [-20.288325053256674, '12', '08'], [-20.28392557816386, '12', '09'], [-20.288843925224885, '12', '10'], [-20.279496094456842, '12', '11'], [-20.275591146820425, '12', '12'], [-20.27903277060147, '12', '13'], [-20.262792339808282, '12', '14'], [-20.264869019101525, '12', '15'], [-20.26400183600108, '12', '16'], [-20.27230086589637, '12', '17'], [-20.271483420936065, '12', '19'], [-20.285468662180968, '12', '20'], [-20.280684800653894, '12', '21'], [-20.274842727474645, '12', '22'], [-20.273819408858106, '12', '23'], [-20.275674711139203, '12', '24'], [-20.270972679593374, '12', '25'], [-20.275038813473316, '12', '26'], [-20.274474630901253, '12', '27'], [-20.273528963283624, '12', '28'], [-20.26965045750198, '12', '29']]
<Figure size 640x480 with 0 Axes>
# first sweep analysis
# plot rms values and db values
fig, axs = plt.subplots(1, 2, figsize=(15,5))
ax = axs[0]
ax.set_title('RMS Values')
ax.set_xlabel('Time (s)')
ax.set_ylabel('RMS Value')
ax.grid(True)
time = [f"{val[1]}:{val[2]}:{val[3]}" for val in rms_values1]
time_in_seconds = [int(val[1]) * 3600 + int(val[2]) * 60 + int(val[3]) for val in rms_values1]
ax.plot(time_in_seconds, [val[0] for val in rms_values1], label='RMS Values', marker='o')
ax.legend()
ax.set_xticks(time_in_seconds)
ax.set_xticklabels(time, rotation=45)
# plot db values
ax = axs[1]
ax.set_title('DB Values')
ax.set_xlabel('Time (s)')
ax.set_ylabel('DB Value')
ax.grid(True)
ax.plot(time_in_seconds, [val[0] for val in db_values1], label='DB Values', marker='o')
ax.legend()
ax.set_xticks(time_in_seconds)
ax.set_xticklabels(time, rotation=45)
#ax.set_yticks(np.arange(np.floor(min([val[0] for val in db_values1])*10)/10, np.ceil(max([val[0] for val in db_values1])*10)/10, 0.2))
plt.suptitle(date1 + ' Sweep 1', fontsize=25)
# second sweep analysis
# plot rms values and db values
fig, axs = plt.subplots(1, 2, figsize=(15,5))
ax = axs[0]
ax.set_title('RMS Values')
ax.set_xlabel('Time (s)')
ax.set_ylabel('RMS Value')
ax.grid(True)
time = [f"{val[1]}:{val[2]}:{val[3]}" for val in rms_values2]
time_in_seconds = [int(val[1]) * 3600 + int(val[2]) * 60 + int(val[3]) for val in rms_values2]
ax.plot(time_in_seconds, [val[0] for val in rms_values2], label='RMS Values', marker='o')
ax.legend()
ax.set_xticks(time_in_seconds)
ax.set_xticklabels(time, rotation=45)
# plot db values
ax = axs[1]
ax.set_title('DB Values')
ax.set_xlabel('Time (s)')
ax.set_ylabel('DB Value')
ax.grid(True)
ax.plot(time_in_seconds, [val[0] for val in db_values2], label='DB Values', marker='o')
ax.legend()
ax.set_xticks(time_in_seconds)
ax.set_xticklabels(time, rotation=45)
#ax.set_yticks(np.arange(np.floor(min([val[0] for val in db_values2])*10)/10, np.ceil(max([val[0] for val in db_values2])*10)/10, 0.2))
plt.suptitle(date1 + ' Sweep 2', fontsize=25)
plt.show(block = False)
# first sweep analysis
# plot rms values and db values
fig, axs = plt.subplots(2, 1, figsize=(20,10))
ax = axs[0]
ax.set_title('RMS Values')
ax.set_xlabel('Time (s)')
ax.set_ylabel('RMS Value')
ax.grid(True)
time = [f"{val[1]}:{val[2]}:{val[3]}" for val in rms2_values1]
time_in_seconds = [int(val[1]) * 3600 + int(val[2]) * 60 + int(val[3]) for val in rms2_values1]
ax.plot(time_in_seconds, [val[0] for val in rms2_values1], label='RMS Values', marker='o')
ax.legend()
ax.set_xticks(time_in_seconds)
ax.set_xticklabels(time, rotation=45)
# plot db values
ax = axs[1]
ax.set_title('DB Values')
ax.set_xlabel('Time (s)')
ax.set_ylabel('DB Value')
ax.grid(True)
ax.plot(time_in_seconds, [val[0] for val in db2_values1], label='DB Values', marker='o')
ax.legend()
ax.set_xticks(time_in_seconds)
ax.set_xticklabels(time, rotation=45)
#ax.set_yticks(np.arange(np.floor(min([val[0] for val in db_values1])*10)/10, np.ceil(max([val[0] for val in db_values1])*10)/10, 0.2))
plt.suptitle(date2 + ' Sweep 1', fontsize=25)
# second sweep analysis
# plot rms values and db values
fig, axs = plt.subplots(2, 1, figsize=(20,10))
ax = axs[0]
ax.set_title('RMS Values')
ax.set_xlabel('Time (s)')
ax.set_ylabel('RMS Value')
ax.grid(True)
time = [f"{val[1]}:{val[2]}:{val[3]}" for val in rms2_values2]
time_in_seconds = [int(val[1]) * 3600 + int(val[2]) * 60 + int(val[3]) for val in rms2_values2]
ax.plot(time_in_seconds, [val[0] for val in rms2_values2], label='RMS Values', marker='o')
ax.legend()
ax.set_xticks(time_in_seconds)
ax.set_xticklabels(time, rotation=45)
# plot db values
ax = axs[1]
ax.set_title('DB Values')
ax.set_xlabel('Time (s)')
ax.set_ylabel('DB Value')
ax.grid(True)
ax.plot(time_in_seconds, [val[0] for val in db2_values2], label='DB Values', marker='o')
ax.legend()
ax.set_xticks(time_in_seconds)
ax.set_xticklabels(time, rotation=45)
#ax.set_yticks(np.arange(np.floor(min([val[0] for val in db_values2])*10)/10, np.ceil(max([val[0] for val in db_values2])*10)/10, 0.2))
plt.suptitle(date2 + ' Sweep 2', fontsize=25)
plt.show(block = False)